//
//  YFDraggableCardContainer.h
//  卡片滑动选择好友
//
//  Created by yang on 16/4/6.
//  Copyright © 2016年 centling. All rights reserved.
//

#import <UIKit/UIKit.h>

@class YFDraggableCardContainer;

typedef NS_OPTIONS(NSInteger, YFDraggableDirection) {
    YFDraggableDirectionDefault     = 0,
    YFDraggableDirectionLeft        = 1 << 0,
    YFDraggableDirectionRight       = 1 << 1,
    YFDraggableDirectionUp          = 1 << 2,
    YFDraggableDirectionDown        = 1 << 3
};


@protocol YFDraggableCardContainerDataSource <NSObject>

- (UIView *)cardContainerViewNextViewWithIndex:(NSInteger)index;
- (NSInteger)cardContainerViewNumberOfViewInIndex:(NSInteger)index;

@end

@protocol YFDraggableCardContainerDelegate <NSObject>

- (void)cardContainerView:(YFDraggableCardContainer *)cardContainerView
    didEndDraggingAtIndex:(NSInteger)index
            draggableView:(UIView *)draggableView
       draggableDirection:(YFDraggableDirection)draggableDirection;

- (void)MoveCardType:(YFDraggableDirection) direction;

@optional
- (void)cardContainerViewDidCompleteAll:(YFDraggableCardContainer *)container;

- (void)cardContainerView:(YFDraggableCardContainer *)cardContainerView
         didSelectAtIndex:(NSInteger)index
            draggableView:(UIView *)draggableView;

- (void)cardContainderView:(YFDraggableCardContainer *)cardContainderView updatePositionWithDraggableView:(UIView *)draggableView draggableDirection:(YFDraggableDirection)draggableDirection widthRatio:(CGFloat)widthRatio heightRatio:(CGFloat)heightRatio;

@end


@interface YFDraggableCardContainer : UIView

@property (nonatomic, assign) YFDraggableDirection canDraggableDirection;
@property (nonatomic, weak) id <YFDraggableCardContainerDataSource> dataSource;
@property (nonatomic, weak) id <YFDraggableCardContainerDelegate> delegate;

- (void)reloadCardContainer;
- (void)movePositionWithDirection:(YFDraggableDirection)direction isAutomatic:(BOOL)isAutomatic;
- (void)movePositionWithDirection:(YFDraggableDirection)direction isAutomatic:(BOOL)isAutomatic undoHandler:(void (^)())undoHandler;
- (UIView *)getCurrentView;

@end
